<ui:composition template="/WEB-INF/template/layoutPadrao.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="titulo">Pesquisa Empenho</ui:define>

	<ui:define name="corpo">
		<h:form>

			<h1>Pesquisa Empenho</h1>

			<p:toolbar style="margin-top:20px">
				<p:toolbarGroup>
					<p:commandButton value="Pesquisa" action="#{pesquisaEmpenhoBean.pesquisar}" update="@form"/>
				</p:toolbarGroup>

				<p:toolbarGroup align="right">
					<p:button value="Novo" outcome="/empenhos/cadastroEmpenho" />
				</p:toolbarGroup>
			</p:toolbar>

			<p:panelGrid columns="2" id="painel"
				style="width:100%; margin-top:20px" columnClasses="rotulo, campo">
				
				<p:outputLabel value="Numero do NE" for="nome" />
				<p:inputText id="nome" size="60" value="#{pesquisaEmpenhoBean.filtro.nome}"/>
				
				<p:outputLabel value="Processo" for="processo" />
				<p:inputMask id="processo" mask="99999999999999999"
					value="#{pesquisaEmpenhoBean.filtro.processo}" />
			</p:panelGrid>

			<p:dataTable id="empenhoTable"
				value="#{pesquisaEmpenhoBean.empenhoFiltrados}" var="empenho"
				style="margin-top: 20px" emptyMessage="Nenhum Nome encontrado."
				rows="20" paginator="true" paginatorAlwaysVisible="false"
				paginatorPosition="bottom">
				
				<p:column headerText="Data da Emissão" style="width: 40px">
					<h:outputText value="#{empenho.dataEmpenho}" >
						<f:convertDateTime pattern="dd/MM/yyyy"/> 
					</h:outputText>
				</p:column>	
				
				<p:column headerText="Nome" style="width: 100px">
					<h:outputText value="#{empenho.empenhoNumero}" />
				</p:column>	
				
				<p:column headerText="Empresa" style="width: 400px">
					<h:outputText value="#{empenho.empresa.nome}" />
				</p:column>	
				
				<p:column headerText="Processo de Origem" style="width: 100px">
					<h:outputText value="#{empenho.processoOrigem}" />
				</p:column>
				
				<p:column headerText="Tipo de Empenho" style="width: 100px">
					<h:outputText value="#{empenho.tipoEmpenho}" />
				</p:column>
				
				<p:column headerText="Processo de Origem" style="width: 100px">
					<h:outputText value="#{empenho.tipoModalidade.descricao}" />
				</p:column>	
				
				<p:column headerText="Numero Processo" style="width: 100px">
					<h:outputText value="#{empenho.processo}" />
				</p:column>							
						
				<p:column headerText="Valor" style="width: 80px">
					<h:outputText value="#{empenho.valorTotal}" />
				</p:column>				
								
				<p:column style="width: 60px; text-align: center">
					<p:button icon="ui-icon-pencil" title="Editar" outcome="/empenhos/cadastroEmpenho" >
						<f:param  name="empenho" value="#{empenho.id}"/>
					</p:button>
					
				</p:column>
			</p:dataTable>
			
			
		</h:form>
	</ui:define>
</ui:composition>